#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QStatusBar>
#include <QLabel>
#include <QProgressBar>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QStatusBar * status = this->statusBar();

//    status->showMessage("状态栏");

    // 创建控件
    QLabel *label1 = new QLabel("这是一条状态栏消息");
    QLabel *label2 = new QLabel("这是另一条状态栏消息");
    QProgressBar *bar = new QProgressBar();
    bar->setRange(0, 100);
    bar->setValue(30);

    // 给状态栏添加控件
    status->addWidget(label1);
    status->addWidget(label2);
    status->addWidget(bar);

    this->setStatusBar(status);
}

MainWindow::~MainWindow()
{
    delete ui;
}

